package javafx.officialdemo.button;

public class FXButton {
	/**
	 * 构造器
		//A button with an empty text caption.
		Button button1 = new Button();
		//A button with the specified text caption.
		Button button2 = new Button("Accept");
		//A button with the specified text caption and icon.
		Image imageOk = new Image(getClass().getResourceAsStream("ok.png"));
		Button button3 = new Button("Accept", new ImageView(imageOk));
	 */
	
	/**
	 * 设置 既有   图片  又有  文字   的按钮  内 文字与图片的间隙
	 * button1.setGraphicTextGap();
	 */
	
	
	/**
	 * 按钮设置事件
	 * button2.setOnAction((ActionEvent e) -> {
	 *  	label.setText("Accepted");
	 * });
	 */
	
	
	/**
	 * 设置按钮特效   	 包  javafx.scene.effect
	 * 
		DropShadow shadow = new DropShadow();
		//Adding the shadow when the mouse cursor is on
		button3.addEventHandler(MouseEvent.MOUSE_ENTERED, (MouseEvent e) -> {
		    button3.setEffect(shadow);
		});
		 
		//Removing the shadow when the mouse cursor is off
		button3.addEventHandler(MouseEvent.MOUSE_EXITED, (MouseEvent e) -> {
		    button3.setEffect(null);
		});
	 */
	
	/**
	 *  使用css设置 按钮 效果
	 *
		//Code added to the CSS file
		.button1{
		    -fx-font: 22 arial; 
		    -fx-base: #b6e7c9;    
		}
		//Code in the ButtonSample.java file
		button1.getStyleClass().add("button1");
	 */
	
	
}
